import Data.List

type Map = [String]

parseInput :: String -> Map
parseInput = lines

columnIndex :: Int -> Int
columnIndex row = 3 * row

enumerate :: [a] -> [(Int, a)]
enumerate xs = zip [0..] xs

getPoint :: (Int, String) -> Char
getPoint (row, line) = 
    (cycle line) !! column
    where
        column = columnIndex row 

getPath :: Map -> [Char] 
getPath = map getPoint . enumerate

countTree :: [Char] -> Int 
countTree = length . filter (=='#')

main :: IO ()
main = do
    input <- readFile "./input.txt"
    print . countTree . getPath . parseInput $ input